<?php

declare(strict_types=1);

namespace Modules\Inventory\Models;

use Catch\Base\CatchModel as Model;

/**
 * @property $id
 * @property $docno
 * @property $trans_type
 * @property $material_no
 * @property $from_location
 * @property $from_lotnum
 * @property $from_unit
 * @property $qty
 * @property $to_location
 * @property $to_lotnum
 * @property $to_unit
 * @property $creator_id
 * @property $created_at
 * @property $updated_at
 * @property $deleted_at
*/
class InventoryTrans extends Model
{


    protected $table = 'inventory_trans';

    protected $fillable = [ 'id','org_code','cargo_code','supplier_code','doc_id', 'from_wms','start_qty','end_qty','to_wms','docno','doc_type', 'trans_type', 'material_no', 'from_location', 'from_lotnum', 'from_unit', 'qty', 'to_location', 'to_lotnum', 'to_unit', 'creator_id', 'created_at', 'updated_at', 'deleted_at' ];

    /**
     * @var array
     */
    protected array $fields = ['id','org_code','cargo_code','supplier_code','from_wms','start_qty','end_qty','to_wms','docno','doc_id','doc_type','trans_type','material_no','from_location','from_lotnum','from_unit','qty','to_location','to_lotnum','to_unit','created_at'];

    /**
     * @var array
     */
    protected array $form = ['id','org_code','cargo_code','supplier_code','doc_id','docno','from_wms','start_qty','end_qty','to_wms','doc_type','trans_type','material_no','from_location','from_lotnum','from_unit','qty','to_location','to_lotnum','to_unit','created_at','updated_at'];

    /**
     * @var array
     */
    public array $searchable = [
        'docno' => 'like',
        'org_code' => '=',
        'cargo_code' => '=',
        'supplier_code' => '=',
        'doc_type' => '=',
        'trans_type' => '=',
        'material_no' => '=',
        'from_lotnum' => '=',
        'to_wms' => '=',
        'to_lotnum' => '=',
        'to_location' => '=',

    ];

    /**
     * 时间格式化
     * @param $date
     * @return mixed
     */
    protected function serializeDate($date)
    {
        return $date->format('Y-m-d H:i');
    }


}
